package com.springboot.mail.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import javax.swing.*;

/**
 * @author wangning
 * @create 2021-05-13 16:13
 */
@Component
public class MailService {
	@Autowired
	private JavaMailSender javaMailSender;

	public void sendSimpleMail(String from, String to, String cc, String subject, String content) {
		SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
		simpleMailMessage.setFrom(from);
		simpleMailMessage.setTo(to);
		simpleMailMessage.setCc(cc);
		simpleMailMessage.setSubject(subject);
		simpleMailMessage.setText(content);
		javaMailSender.send(simpleMailMessage);

	}
}
